package com.jt.config;

import com.jt.pojo.Student;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;


/**
 * @outhor fufeixiang
 * @date 2021-04-23
 */
@Configurable
@ComponentScan("com.jt")
@PropertySource(value = "classpath:/student.properties",encoding = "utf-8")
public class SpringConfig {
    @Value("${student.id}")
    private Integer id;
    @Value("${student.username}")
    private String username;
    @Bean
    public Student student(){

        Student student = new Student();
        student.setId(id);
        student.setUsername(username);
        return student;
    }
}
